package wolftrace_company.study_android_ui.activity;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;

import wolftrace_company.study_android_ui.R;
import wolftrace_company.study_android_ui.dialog.MyDialog;

/**
 * Created by SimpleTonOne on 2018/4/2.
 */

public class ShowMyDialogActitvity extends AppCompatActivity {
    private Button button;
    private MyDialog myDialog;
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
        setContentView(R.layout.dialogpage);
        button = findViewById(R.id.btn_show_dialog);
//        myDialog = new MyDialog(this);

//
//        myDialog.setCanceledOnTouchOutside(false);
//        myDialog.show();
        button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                myDialog = new MyDialog(ShowMyDialogActitvity.this);
                myDialog.setNoOnclickListener("返回", new MyDialog.onNoOnclickListener() {
                    @Override
                    public void onNoClick() {
                        finish();
                        Toast.makeText(ShowMyDialogActitvity.this,"你点击了返回按钮",Toast.LENGTH_LONG).show();
                    }
                });
                myDialog.setYesOnclickListener("确定", new MyDialog.onYesOnclickListener() {
                    @Override
                    public void onYesClick() {
                        Toast.makeText(ShowMyDialogActitvity.this,"你点击了确定按钮",Toast.LENGTH_LONG).show();
                    }
                });
                myDialog.show();
            }
        });
    }


}
